<%@page import="com.swim.entity.RegisteredUser"%>
<%@page import="com.swim.entity.Collaboration"%>
<%@page import="com.swim.entity.RegisteredUser"%>
<%@page import="com.swim.entity.SkillRequest"%>
<%@page import="com.swim.entity.CollaborationRequest"%>
<%@page import="com.swim.entity.FriendshipRequest"%>
<%@page import="com.swim.entity.Skill"%>
<%@page import="java.util.List"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>SWIM - Collaborations</title>
<link href='http://fonts.googleapis.com/css?family=Arvo'
	rel='stylesheet' type='text/css' />
<link href="css/style.css" rel="stylesheet" type="text/css"
	media="screen" />
</head>
<body>
<%
	Object admin = request.getSession().getAttribute("admin");
	%>
	<div id="menu-wrapper">
		<div id="menu">
			<ul>
				<li><a href="index.jsp">Homepage</a></li>
				<li class="current_page_item"><a href="collaboration.jsp">Collaborations</a></li>
				<li><a href="friends.jsp">Friends</a></li>
				<li><a href="edit.jsp">Edit Profile</a></li>
				<li><a href="logout.jsp">Logout</a></li>
				
				<%if (admin == null || !(Boolean) admin) {
				%>	
				<li><a href="newskillreq.jsp">Request Skill</a></li>
				<%}  else {
				%>	
				<li><a href="newskill.jsp">Create Skill</a></li>
				<%}%>
			</ul>
		</div>
		<!-- end #menu -->
	</div>

	<div id="wrapper">
		<div id="header-wrapper">
			<div id="header">
				<div id="logo">
					<h1>
						<a href="#">SWIM</a>
					</h1>
					<p>"A social network for friends needing or offering help"</p>
				</div>
			</div>
		</div>
		<!-- end #header -->
		<div id="page">
			<div id="page-bgtop">
				<div id="page-bgbtm">
					<div id="content">
						<div class="post">
							<h2 class="title">Collaborations</h2>
							<div class="entry">
								<p style="font-size: 17px;">Here is a list of your collaborations</p>
							</div>
						</div>
						
						<div class="post">
							<h2 class="title">Received Collaborations</h2>
							<div class="entry">
							<% List<Collaboration> list1 = (List<Collaboration>) request.getAttribute("collaborationsReceived");
							for(Collaboration c: list1) {
								%>
									<ul>
										<li><b>Collaboration date:</b> <%= c.getDate() %></li>
										<li><b>Helper:</b> <%= "<a href=\"profile.jsp?email="+c.getEmailFrom().getEmail()+"\">"+c.getEmailFrom().getName() %></a></li>
										<li><b>Skill involved:</b> <%= c.getIdSkill().getName() %></li>
										<% if(c.getIdFeedback() != null) { %>
												<li><b>Feedback left:</b> "<%= c.getIdFeedback().getDescription() %>"</li>
											<% }  else {
												out.print("<li>You haven't left a feedback yet! <a href=\"newfb.jsp?id="
															+Integer.toString(c.getId())+"\">Add Feedback</a></li>");
											}%>
									</ul>
							<% } %>
							</div>
						</ul>
						</div>
						
						<div class="post">
							<h2 class="title">Offered Collaborations</h2>
							<div class="entry">
							<% List<Collaboration> list = (List<Collaboration>) request.getAttribute("collaborationsOffered");
								for(Collaboration c: list) {
									%>
										
										<ul>
											<li><b>Collaboration date:</b> <%= c.getDate() %></li>
											<li><b>Helping:</b> <%= "<a href=\"profile.jsp?email="+c.getEmailTo().getEmail()+"\">"+c.getEmailTo().getName() %></a></li>
											<li><b>Skill involved:</b> <%= c.getIdSkill().getName() %></li>
											<% if(c.getIdFeedback() != null) { %>
												<li><b>Received Feedback:</b> "<%= c.getIdFeedback().getDescription() %>"</li>
										</ul>
										<% }
								} %>
							</div>
						</div>
						<div style="clear: both;">&nbsp;</div>
					</div>
					<!-- end #content -->
					<div id="sidebar">
						
					</div>
					<!-- end #sidebar -->
					<div style="clear: both;">&nbsp;</div>
				</div>
			</div>
		</div>
		<!-- end #page -->
	</div>
	<div id="footer">
		<p></p>
	</div>
	<!-- end #footer -->
</body>
</html>